<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>部门和科室管理员</title>
    <!--引入vue得依赖必须再elementui之前引入vue-->
    <link type="text/css" rel="stylesheet" href="css/index.css">
    <script type="text/javascript" src="/js/vue.js"></script>
    <script type="text/javascript" src="/js/index.js"></script>
    <script type="text/javascript" src="/js/axios.min.js"></script>
    <script type="text/javascript" src="/js/qs.min.js"></script>

    <style>
        #centertitle{
            text-align: center;
        }
        li,ul{
            padding:0;
            margin:0;
            list-style:none;
        }
        #app{
            padding-left: 50px;
        }
    </style>
</head>
<body>
    <div id="centertitle">
        <h1>排班管理系统</h1>
    </div>
    <div id="app">
        <ul>
            <li v-for="(dept,index) in deptSection">
                <el-divider content-position="left">{{dept.name}}</el-divider>
                <el-button type="primary" plain v-for="(section,index1) in dept.sections" @click="schedul(section.id)">{{section.name}}</el-button>
            </li>
        </ul>
    </div>

    <script>
        var app = new Vue({
            el:"#app",
            data:{
                deptSection:[],
            },
            created(){
                this.sinit();
            },
            methods:{
                //初始化
                sinit(){
                    axios.get("/ManaginePrivilegesController/selectDeptSection").then(resp=>{
                        console.log(resp);
                        this.deptSection=resp.data.data;
                        console.log(this.deptSection);
                    });
                },
                schedul(id){
                    console.log(id);
                    axios.post("/ManaginePrivilegesController/addSectionId?id="+id).then(resp=>{
                        location.href="/scheduling.html";
                    });
                },
            },
        })
    </script>
</body>
</html>